package com.example.controller;

import com.example.pojo.GenderCount;
import com.example.pojo.JobOption;
import com.example.pojo.Result;
import com.example.service.RepostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * JobOptionController 类的描述信息
 *
 * @author 12427
 * @since 2025/6/7 9:41
 */
@Slf4j
@RestController
@RequestMapping("/report")
public class JobOptionController {
    @Autowired
    RepostService repostService;

    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("统计各个职位人数");
//        将结果封装到对应对象中
        JobOption jobOption = repostService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 统计性别  分别多少人
     */
    @GetMapping("/empGenderData")
    public Result empGenderData() {
//        封装到对象
        log.info("统计员工性别");
//        也可以不用封装到对象中
//        List<GenderCount> genderCount =  repostService.getEmpGenderData();
//        return Result.success(genderCount);
        List<Map<String, Object>> list = repostService.getEmpGenderData();
        return Result.success(list);
    }

    /**
     * 统计学员的学历信息
     */
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData() {
        log.info("统计学员的学历信息");
        List<Map<String, Object>> list = repostService.studentDegreeData();
        return Result.success(list);
    }

    /**
     * 班级人数统计
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("统计班级人数");
        Map<String, Object> countData = repostService.getStudentCountData();
        return Result.success(countData);
    }

}
